package com.me.libgdx_test;

import com.badlogic.gdx.scenes.scene2d.Actor;
import com.badlogic.gdx.scenes.scene2d.Group;
import com.badlogic.gdx.scenes.scene2d.ui.Image;
import com.badlogic.gdx.scenes.scene2d.ui.Label;
import com.me.libgdx_test.ClassUnlockablePrototypes.UnlockFactory;

//This class creates an achievement object that can be attached to any stage
public class ClassAchievementInfo extends AbstractClassAchievement{

	ClassAchievementInfo(ActivityMain game, Point dimensions){
		super(game,dimensions);
	}
	void populate_achievement_object(){
		refresh_achievements();
		
		int x_space = dimensions.x/40;
		int y_space = dimensions.y/40;
		int x_margin = 0;
		int y_margin = 0;
		
		logger.print("1");
		
		achievement_group.setPosition(x_space, dimensions.y - y_space*3);
		
		//Group inner_group = new Group();
		
		//inner_group.setPosition(achievement_group.getX() + x_space, achievement_group.getY() + y_space);
		
		//market_item_image.setPosition(dimensions.x/10, element_y);
		//level_icon.setPosition(location.x, element_y);
		level_icon.setSize(dimensions.x/30,dimensions.x/30);
		achievement_group.addActor(level_icon);
		
		logger.print("2");
		
		x_margin += level_icon.getWidth() + x_space;
		
		final Label level_label = new Label(String.valueOf(current_level), skin.get_skin());
		level_label.setFontScale(1.5f);
		//description_label.setWrap(true);
		//description_label.setPosition(location.x+padding, element_y);
		level_label.setPosition(x_margin + level_label.getX(), y_margin + level_label.getY());
		level_label.setSize(dimensions.x/30,dimensions.x/30);
		achievement_group.addActor(level_label);
		
		logger.print("3");
		
		//x_margin += level_label.getWidth() + x_space/2;
		x_margin = 0;
		y_margin -= level_icon.getHeight() + y_space;
		
		//market_item_image.setPosition(dimensions.x/10, element_y);
		//level_icon.setPosition(location.x, element_y);
		honor_icon.setPosition(x_margin + honor_icon.getX(), y_margin);
		honor_icon.setSize(dimensions.x/30,dimensions.x/30);
		achievement_group.addActor(honor_icon);
		
		logger.print("4");
		
		x_margin += honor_icon.getWidth() + x_space;
		
		final Label honor_label = new Label(String.valueOf(current_honor), skin.get_skin());
		honor_label.setFontScale(1.5f);
		//description_label.setWrap(true);
		//description_label.setPosition(location.x+padding, element_y);
		honor_label.setPosition(x_margin + honor_label.getX(), y_margin + honor_label.getY());
		honor_label.setSize(dimensions.x/30,dimensions.x/30);
		achievement_group.addActor(honor_label);
		
		logger.print("5");
		
		//x_margin += gem_label.getWidth() + x_space/2;
		x_margin = 0;
		y_margin -= honor_icon.getHeight() + y_space;
		
		//market_item_image.setPosition(dimensions.x/10, element_y);
		//level_icon.setPosition(location.x, element_y);
		gold_icon.setPosition(x_margin + gold_icon.getX(), y_margin);
		gold_icon.setSize(dimensions.x/30,dimensions.x/30);
		achievement_group.addActor(gold_icon);
		
		logger.print("6");
		
		x_margin += gold_icon.getWidth() + x_space;
		
		final Label gold_label = new Label(String.valueOf(current_gold), skin.get_skin());
		gold_label.setFontScale(1.5f);
		//description_label.setWrap(true);
		//description_label.setPosition(location.x+padding, element_y);
		gold_label.setPosition(x_margin + gold_label.getX(), y_margin + gold_label.getY());
		gold_label.setSize(dimensions.x/30,dimensions.x/30);
		achievement_group.addActor(gold_label);

		logger.print("7");
	}
	public void refresh_achievement_group(){
		populate_achievement_object();
	}
	public Group get_achievement_group(){
		populate_achievement_object();
		return achievement_group;
	}
}
